import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/components/layout.vue";

const routes = [
  {
    path: "/login",
    name: "login",
    meta: { title: "登录/注册" },
    component: () => import("@/views/login/index.vue"),
  },
  {
    path: "/",
    component: Layout,
    redirect: "/index",
    children: [
      {
        path: "/index",
        name: "index",
        meta: { title: "首页", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/index/index.vue"),
      },
      {
        path: "/activity",
        name: "activity",
        meta: { title: "活动", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/activity/index.vue"),
      }, 
      {
        path: "/goodsPayDetail",
        name: "goodsPayDetail",
        meta: { title: "商品详情" },
        component: () => import("@/views/activity/goodsPayDetail.vue"),
      }, 
      {
        path: "/activityDetail",
        name: "activityDetail",
        meta: { title: "动态详情", active: 0, titleShow: false, },
        component: () => import("@/views/activity/detail.vue"),
      },
      {
        path: "/inform",
        name: "inform",
        meta: { title: "通知", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/infor/index.vue"),
      },
      {
        path: "/personage",
        name: "personage",
        meta: { title: "我的", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/personage/index.vue"),
      },
      {
        path: "/order",
        name: "order",
        meta: { title: "订单", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/personage/orderList.vue"),
      },
      {
        path: "/address",
        name: "address",
        meta: { title: "地址列表", active: 0, titleShow: false, },
        component: () => import("@/views/personage/address.vue"),
      },
      {
        path: "/collect",
        name: "collect",
        meta: { title: "收藏", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/personage/collect.vue"),
      },
      {
        path: "/follow",
        name: "follow",
        meta: { title: "关注", active: 0, titleShow: false, barShow: true },
        component: () => import("@/views/personage/follow.vue"),
      },
      {
        path: "/memberCenter",
        name: "memberCenter",
        meta: { title: "会员中心", active: 0, titleShow: false, },
        component: () => import("@/views/personage/memberCenter.vue"),
      },
      {
        path: "/setting",
        name: "setting",
        meta: { title: "设置", active: 0, titleShow: false, },
        component: () => import("@/views/personage/setting.vue"),
      },
      {
        path: "/list",
        name: "list",
        meta: { title: "列表", },
        component: () => import("@/views/list/index.vue"),
      },
      {
        path: "/goodsOrder",
        name: "goodsOrder",
        meta: { title: "加入VIP", titleShow: true },
        component: () => import("@/views/goodsOrder/index.vue"),
      },
      {
        path: "/goodsFlockOrder",
        name: "goodsFlockOrder",
        meta: { title: "加入VIP", titleShow: false },
        component: () => import("@/views/goodsFlockOrder/index.vue"),
      },
      {
        path: "/goodsDetail",
        name: "goodsDetail",
        meta: { title: "商品详情", },
        component: () => import("@/views/goodsDetail/index.vue"),
      },
      {
        path: "/home",
        name: "home",
        meta: { title: "支付", },
        component: () => import("@/views/home/index.vue"),
      },
      {
        path: "/payOrder",
        name: "payOrder",
        meta: { title: "支付订单", },
        component: () => import("@/views/payOrder/index.vue"),
      }, {
        path: "/payResult",
        name: "payResult",
        meta: { title: "支付成功", titleShow: true, },
        component: () => import("@/views/payResult/index.vue"),
      }, {
        path: "/mine",
        name: "mine",
        meta: { title: "我的", active: 1, titleShow: true },
        component: () => import("@/views/mine/index.vue"),
      }
      , {
        path: "/settingMine",
        name: "settingMine",
        meta: { title: "设置", active: 1 },
        component: () => import("@/views/mine/settingMine.vue"),
      }
      , {
        path: "/anchor",
        name: "anchor",
        meta: { title: "主播", titleShow: true, },
        component: () => import("@/views/anchor/index.vue"),
      },
      {
        path: "/myAnchor",
        name: "myAnchor",
        meta: { title: "加载中", active: 0, },
        component: () => import("@/views/login/index.vue"),
      },
      {
        path: "/register",
        name: "register",
        meta: { title: "登录/注册", titleShow: true, active: 0, },
        component: () => import("@/views/register/index.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
